/*
 * ResourceExtractorFilter.h
 *
 *  Created on: Nov 20, 2008
 *      Author: Ryan
 */

#ifndef RESOURCEEXTRACTORFILTER_H_
#define RESOURCEEXTRACTORFILTER_H_

#include "../../../OOInterface/Interfaces/UnitVisitor.h"

class ResourceExtractorFilter: public FilterVisitor
{
public:
	ResourceExtractorFilter() : _extractor(false) {}
	virtual ~ResourceExtractorFilter() {}

	virtual void visitUnit( const OOInterface::Unit& u ){}

	virtual void visitAirAspect( const OOInterface::AirAspect& a ){}
	virtual void visitLandAspect( const OOInterface::LandAspect& a ){}
	virtual void visitWaterAspect( const OOInterface::WaterAspect& a ){}

	virtual void visitBuilderAspect( const OOInterface::BuilderAspect& a ) {}
	virtual void visitBuildingAspect( const OOInterface::BuildingAspect& a ) {}
	virtual void visitTransportAspect( const OOInterface::TransportAspect& a ){}

	virtual void visitReclaimableAspect( const OOInterface::ReclaimableAspect& a ){}
	virtual void visitResourceExtractorAspect( const OOInterface::ResourceExtractorAspect& a ) { _extractor = true; _aspect = &a; }

	virtual bool isFiltered() { return !isExtractor(); }
	virtual void reset() { _extractor = false; }
	bool isExtractor() { return _extractor; }
	const OOInterface::ResourceExtractorAspect* getExtractorAspect() { return _aspect; }
private:
	const OOInterface::ResourceExtractorAspect* _aspect;
	bool _extractor;
};

#endif /* RESOURCEEXTRACTORFILTER_H_ */
